import { axios } from '@/utils/request'
import { getAction, deleteAction, putAction, postAction, httpAction } from '@/api/manage'

/**
 * 库存列表查询
 * @param params 查询参数
 */
export function inventoryList(params) {
  return getAction('/wms/inventory/list', params)
}

/**
 * 库存导出
 * @param params 查询参数
 */
export function inventoryExport(params) {
  return getAction('/wms/inventory/exportInventoryList', params)
}

/**
 * 库存入库
 * @param inventory 库存信息
 * @param params 入库参数
 */
export function inventoryInbound(inventory, params) {
  return postAction('/wms/inventory/inbound', inventory, params)
}

/**
 * 带成本的库存入库
 * @param inventory 库存信息
 * @param params 入库参数
 */
export function inventoryInboundWithCost(inventory, params) {
  return axios({
    url: '/wms/inventory/inboundWithCost',
    method: 'post',
    data: inventory,
    params: params
  })
}

/**
 * 库存出库
 * @param inventory 库存信息
 * @param params 出库参数
 */
export function inventoryOutbound(inventory, params) {
  return postAction('/wms/inventory/outbound', inventory, params)
}

/**
 * 库存移动
 * @param moveVO 移动信息
 */
export function inventoryMove(moveVO) {
  return postAction('/wms/inventory/move', moveVO)
}

/**
 * 库存调整
 * @param adjustVO 调整信息
 */
export function inventoryAdjust(adjustVO) {
  return postAction('/wms/inventory/adjust', adjustVO)
}

/**
 * 查询物料库存
 * @param materialCode 物料编码
 * @param warehouseId 仓库ID
 * @param locationId 库位ID
 */
export function queryInventoryByMaterial(materialCode, warehouseId, locationId) {
  return getAction('/wms/inventory/queryByMaterialAndWarehouse', {
    materialCode,
    warehouseId,
    locationId
  })
}

/**
 * 查询库存历史
 * @param params 查询参数
 */
export function inventoryHistoryList(params) {
  return getAction('/wms/inventoryHistory/list', params)
}

/**
 * 查询库存历史详情
 * @param id 历史记录ID
 */
export function inventoryHistoryDetail(id) {
  return getAction('/wms/inventoryHistory/queryById', { id })
}

/**
 * 库存历史导出
 * @param params 查询参数
 */
export function inventoryHistoryExport(params) {
  return getAction('/wms/inventoryHistory/exportInventoryHistoryList', params)
} 